//
//  Student.m
//  OC07_作业
//
//  Created by dllo on 15/12/9.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "Student.h"

@implementation Student

- (instancetype)init {
    self = [super init];
    if (self) {
        self.grade = [NSMutableDictionary dictionary];
    }
    return self;
}

- (instancetype)initWithName:(NSString *)name
                         age:(NSInteger)age
                      number:(NSInteger)number
                       grade:(NSMutableDictionary *)grade {
    self = [super initWithName:name age:age];
    if (self) {
        self.number = number;
        self.grade = grade;
    }
    return self;
}

+ (instancetype)studentWithName:(NSString *)name
                            age:(NSInteger)age
                         number:(NSInteger)number
                          grade:(NSMutableDictionary *)grade {
    Student *student = [Student studentWithName:name age:age number:number grade:grade];
    return [student autorelease];
}

/** 比较年龄 */
- (NSComparisonResult)compareAgeUP:(Student *)student {
    if (self.age > student.age) {
        return NSOrderedDescending;
    } if (self.age < student.age) {
        return NSOrderedAscending;
    } else {
        return NSOrderedSame;
    }
}

- (void)dealloc {
    [_grade release];
    [super dealloc];
}



@end
